package com.ruoyi.project.pm.filingaudit.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.pm.filingaudit.domain.PMFA;
import com.ruoyi.project.pm.filingaudit.mapper.PMFAMapper;
import com.ruoyi.project.pm.filingaudit.service.PMFAService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.xml.ws.soap.Addressing;
import java.util.List;

/**
 * @author 铁蛋儿
 * @date 2020-09-18 14:29
 * @desc 百战程序员 http://www.itbaizhan.com
 *
 * 项目归档审核 控制器  继承 BaseController
 *
 */
@Controller
@RequestMapping("/pm/filingaudit")
public class PMFAController extends BaseController {

    //前缀字符串  用户跳转到前端页面
    private String prefix = "/pm/filingaudit";

    //注入service层对象
    @Autowired
    private PMFAService pmfaService;

    /**
     * 用于跳转到项目归档审核的前端页面
     * @return   返回到templates/pm/filingaudit/filingaudit.html页面
     */
    @RequiresPermissions("pm:filingaudit:view")
    @GetMapping()
    public String filingAudit(){
        return prefix + "/filingaudit";
    }

    @RequiresPermissions("pm:filingaudit:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PMFA pmfa){
        //开始分页
        startPage();
        //调用服务层方法 查询所有
        List<PMFA> list = pmfaService.selectPMFAList(pmfa);

        //返回分页数据
        return getDataTable(list);
    }

    /**
     * 跳转到审核页面
     * @param pmId
     * @param model
     * @return
     */
    @GetMapping("/audit/{pmId}")
    public String toAudit(@PathVariable("pmId") Integer pmId, Model model){
        System.out.println("pmId=" + pmId);
        System.out.println("跳转到审核页面");

        return prefix + "/audit";
    }

}
